import { createRouter, createWebHistory } from 'vue-router'
import home from '../views/home/index.vue'
import Footer from '../components/Footer.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    // component: home
    components: {
      default: home,
      footer: Footer
    }
  },
  {
    path: '/kind',
    name: 'kind',
    // component: () => import('../views/kind/index.vue')
    components: {
      default: () => import('../views/kind/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import('../views/cart/index.vue')
  },
  {
    path: '/user',
    name: 'user',
    // component: () => import('../views/user/index.vue')
    components: {
      default: () => import('../views/user/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: () => import('../views/detail/index.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search/index.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/index.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/register/index.vue')
  },
  {
    path: '/order',
    name: 'order',
    component: () => import('../views/order/index.vue')
  },
  {
    path: '/order/list',
    name: 'orderList',
    component: () => import('../views/order/list.vue')
  },
  {
    path: '/success',
    name: 'success',
    component: () => import('../views/success/index.vue')
  },
  {
    path: '/myorder',
    name: 'myorder',
    component: () => import('../views/myorder/index.vue')
  },
  {
    path: '/myorder/detail/:id',
    name: 'myorderDetail',
    component: () => import('../views/myorder/detail.vue')
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
